package demo1223.pm;

import java.io.File;
import java.io.IOException;

/*
查看一个目录中所有的文件和目录
 */
public class Demo_01 {
    public static void main(String[] args) throws IOException {
        File file = new File("a\\b");
        File file1 = new File(file, "b.txt");
        File file2 = new File(file, "cc.txt");
        file1.mkdirs();
        file2.createNewFile();
//        find(new File("a"));
    }

    /**
     * 查询一个目录下所有的filename文件,打印路径
     * 模糊查询
     *
     * @param file
     * @param filename
     */
    public static void find(File file, String filename) {
        if (file.isFile()) {
            String absolutePath = file.getAbsolutePath();
            System.out.println(absolutePath);
        } else {
            String absolutePath = file.getAbsolutePath();
            System.out.println(absolutePath);
            File[] list = file.listFiles();
            if (list == null) {
                return;
            }
            for (File file1 : list) {

            }
        }
    }
}
